package com.edu.service.impl;

import com.edu.bo.StudentScoreVO;
import com.edu.component.PageBean;
import com.edu.component.QueryParam;
import com.edu.dao.RoleMapper;
import com.edu.dao.ScoreDetailMapper;
import com.edu.entity.ScoreDetail;
import com.edu.entity.Selection;
import com.edu.service.RoleService;
import com.edu.service.ScoreDetailService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ScoreDetailServiceImpl implements ScoreDetailService {
    @Autowired
    private ScoreDetailMapper SDMapper;
    @Override
    public PageBean listPage(QueryParam param) {
        //1.开启分页拦截的功能
        // Page: 页码, Limit: 页大小,true: 是否要记录数
        Page retPage = PageHelper.startPage( param.getPage(),param.getLimit(),true);
        //2.执行查询
        SDMapper.queryList( param.getParam() );
        //3.把 Page 装载进 PageBean 并返回
        return new PageBean(retPage);
    }
    @Override
    public void savePaperTestRecord(List<ScoreDetail> list) {
        int updateCnt = SDMapper.savePaperTestRecord(list);
        if ( updateCnt !=list.size() ){
            throw new RuntimeException("保存考试记录失败.");
        }
    }
    @Override
    public StudentScoreVO queryStudentScore(StudentScoreVO stuScoreVO) {
        //学生实现
        return null;
    }
    @Override
    public List<StudentScoreVO> queryAllStudentScore(Integer id) {

        return null;
    }
}


